package com.lxy.elasticsearch200.controller;

import com.lxy.elasticsearch200.base.result.Result;
import com.lxy.elasticsearch200.dto.AddStudentDto;
import com.lxy.elasticsearch200.dto.StudentListDto;
import com.lxy.elasticsearch200.service.ExamStudentService;
import com.lxy.elasticsearch200.vo.ListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 学生模块
 * </p>
 *
 * @author Administrator
 * @since 2024/11/16
 */
@RestController
@RequestMapping("/stu/")
public class ExamStudentController {

    private ExamStudentService examStudentService;

    @PostMapping("add")
    public Result<Boolean> add(@Valid @RequestBody AddStudentDto addStudentDto) {
        return examStudentService.add(addStudentDto);
    }

    @PostMapping("list")
    public Result<List<ListVo>> list(@Valid @RequestBody StudentListDto studentListDto) {
        return examStudentService.list(studentListDto);
    }

    @Autowired
    public void setExamStudentService(ExamStudentService examStudentService) {
        this.examStudentService = examStudentService;
    }
}
